

<title>监控设置 - 节点管理</title>

<div class="layui-card layadmin-header">
  <div class="layui-breadcrumb" lay-filter="breadcrumb">
    <a lay-href="">首页</a>
    <a><cite>节点管理</cite></a>
    <a><cite>监控设置</cite></a>
  </div>
</div>

<style type="text/css">
.layui-elem-quote{padding: 6px;}
.thin-gray{font-weight: 400;color: #999;} 
.small-title{font-weight:700;font-size:14px}
hr {margin-bottom: 30px}
</style>
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md12">
      <div class="layui-card">
        <div class="layui-card-body">
         <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
          <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">

              <fieldset class="layui-elem-field">
                <legend>IP可用性监控</legend>
                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">间隔时间：</div>
                    <div class="layui-col-md2 layui-form">
                      <input type="radio" lay-filter="interval" name="interval" value="30" title="30秒" >
                      <input type="radio" lay-filter="interval" name="interval" value="60" title="1分钟" >
                      <input type="radio" lay-filter="interval" name="interval" value="300" title="5分钟" >
                    </div>
                  </div> 
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">连续失败次数：</div>
                    <div class="layui-col-md2"><input type="text" name="failed_times"  value="" autocomplete="off" class="layui-input"></div>
                  </div>     
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">监控点失败比率 (%)：</div>
                    <div class="layui-col-md2"><input type="text" name="failed_rate"  value="" autocomplete="off" class="layui-input"></div>
                  </div>  
    
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">监控服务器地址：</div>
                    <div class="layui-col-md2"><input type="text" name="monitor_api"  placeholder="留空则使用系统默认" value="" autocomplete="off" class="layui-input"></div>
                  </div> 
                </div>
              </fieldset>
              
              <p>&nbsp;</p>
              <fieldset class="layui-elem-field">
                <legend>节点带宽监控</legend>
                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">连续带宽超限次数：</div>
                    <div class="layui-col-md2"><input type="text" name="bw_exceed_times"  value="" autocomplete="off" class="layui-input"></div>
                  </div>     
                </div>
              </fieldset>

              <p>&nbsp;</p>
              <fieldset class="layui-elem-field">
                <legend>通知设置</legend>
                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">通知时间段：</div>
                    <div class="layui-col-md2"><input type="text" name="notification_period"  value="" autocomplete="off" class="layui-input"></div>
                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">通知方式：</div>
                    <div class="layui-col-md2 layui-form">
                      <input type="checkbox" name="notify_method" lay-filter="notify_method" value="email" title="电子邮件" lay-skin="primary" >
                      <input type="checkbox" name="notify_method" lay-filter="notify_method" value="sms" title="手机短信" lay-skin="primary" > 
                    </div>
                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">消息类型订阅：</div>
                    <div class="layui-col-md10 layui-form">
                      <input type="checkbox" name="notify_msg_type" lay-filter="notify_msg_type" value="节点IP解析" title="IP可用性监控" lay-skin="primary" >
                      <input type="checkbox" name="notify_msg_type" lay-filter="notify_msg_type" value="带宽监控" title="带宽超限" lay-skin="primary" > 
                      <input type="checkbox" name="notify_msg_type" lay-filter="notify_msg_type" value="备用IP" title="备用IP切换" lay-skin="primary" > 
                      <input type="checkbox" name="notify_msg_type" lay-filter="notify_msg_type" value="备用默认解析" title="备用默认解析切换" lay-skin="primary" > 
                      <input type="checkbox" name="notify_msg_type" lay-filter="notify_msg_type" value="备用线路组" title="备用线路组切换" lay-skin="primary" > 
                    </div>
                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">通知的邮箱地址：</div>
                    <div class="layui-col-md2"><input type="text" name="email"  value="" autocomplete="off" class="layui-input"></div>
                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">通知的手机号码：</div>
                    <div class="layui-col-md2"><input type="text" name="phone"  value="" autocomplete="off" class="layui-input"></div>
                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">IP可用性通知模板：</div>
                    <div class="layui-col-md2 ip-disable-templ-smsbao smsbao">
                      <input type="text" name="ip_disable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 ip-disable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="ip_disable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">IP禁用的模板及模板ID</span>

                  </div>     

                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2"></div>
                    <div class="layui-col-md2 ip-enable-templ-smsbao smsbao">
                      <input type="text" name="ip_enable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 ip-enable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="ip_enable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">IP启用的模板及模板ID</span>

                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">带宽超限通知模板：</div>
                    <div class="layui-col-md2 bandwidth-exceed-templ-smsbao smsbao">
                      <input type="text" name="bandwidth_exceed_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 bandwidth-exceed-templ-qcloud layui-hide  qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="bandwidth_exceed_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">带宽超限的模板及模板ID</span>

                  </div>     

                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2"></div>
                    <div class="layui-col-md2 bandwidth-restore-templ-smsbao smsbao">
                      <input type="text" name="bandwidth_restore_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 bandwidth-restore-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="bandwidth_restore_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">带宽恢复的模板及模板ID</span>

                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">备用IP切换通知模板：</div>
                    <div class="layui-col-md2 backup-ip-enable-templ-smsbao smsbao">
                      <input type="text" name="backup_ip_enable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-ip-enable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_ip_enable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用IP启用的模板及模板ID</span>

                  </div>     

                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2"></div>
                    <div class="layui-col-md2 backup-ip-disable-templ-smsbao smsbao">
                      <input type="text" name="backup_ip_disable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-ip-disable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_ip_disable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用IP禁用的模板及模板ID</span>

                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">备用默认解析切换通知模板：</div>
                    <div class="layui-col-md2 backup-default-line-enable-templ-smsbao smsbao">
                      <input type="text" name="backup_default_line_enable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-default-line-enable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_default_line_enable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用默认解析启用的模板及模板ID</span>

                  </div>     

                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2"></div>
                    <div class="layui-col-md2 backup-default-line-disable-templ-smsbao smsbao">
                      <input type="text" name="backup_default_line_disable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-default-line-disable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_default_line_disable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用默认解析禁用的模板及模板ID</span>

                  </div>     
                </div>

                <div class="layui-field-box">
                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2">备用线路组切换通知模板：</div>
                    <div class="layui-col-md2 backup-node-group-enable-templ-smsbao smsbao">
                      <input type="text" name="backup_node_group_enable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-node-group-enable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_node_group_enable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用线路组启用的模板及模板ID</span>

                  </div>     

                  <div class="layui-row layui-col-space10">
                    <div class="layui-col-md2"></div>
                    <div class="layui-col-md2 backup-node-group-disable-templ-smsbao smsbao">
                      <input type="text" name="backup_node_group_disable_templ" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2 backup-node-group-disable-templ-qcloud layui-hide qcloud">
                      <input readonly type="text" placeholder="模板"  value="" autocomplete="off" class="layui-input">
                    </div>

                    <div class="layui-col-md2">
                      <input type="text" name="backup_node_group_disable_templ_id"  placeholder="模板ID（使用腾讯云短信需要填）" value="" autocomplete="off" class="layui-input">
                    </div>
                    <span style="line-height: 45px;">备用线路组禁用的模板及模板ID</span>

                  </div>     
                </div>

              </fieldset>

            </div>
        </div>
      </div>                 

    </div>
  </div>
</div>
</div>
</div>

<script type="text/javascript">
  layui.use(['admin', 'table','form'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,view = layui.view
    ,table = layui.table
    ,form = layui.form;

    form.render()

    function phone_templ_convert(content) {
      var content = content.replace(/【.*】/g,"")
      var variables = content.match(/\{\{.*?\}\}/g)
      if (variables) {
        for (let index = 0; index < variables.length; index++) {
          const element = variables[index];
          content = content.replace(element,"{"+(index+1)+"}")
        } 
      }

      return content
    } 

    // 获取手机短信类型
    var sms_config_ajax = admin.req({
      url: '/configs/global-0-system-sms_config'
      ,type: "get"
      ,contentType:"application/json"
      ,dataType: "json"        
      ,done: function(res){
        var value = JSON.parse(res.data.value)
        var type = value.type
        window.sms_type = type
      }
    });

    $.when(sms_config_ajax).then(function () {
      // 获取配置
      admin.req({
        url: '/configs/global-0-system-node_monitor_config' //实际使用请改成服务端真实接口
        ,type: "get"
        ,contentType:"application/json"
        ,dataType: "json"        
        ,done: function(res){
          var data = JSON.parse(res.data.value)
          $("input[name='interval'][value='"+data.interval+"']").prop("checked",true)
          $("input[name='failed_times']").val(data.failed_times)
          $("input[name='failed_rate']").val(data.failed_rate)
          $("input[name='bw_exceed_times']").val(data.bw_exceed_times)

          $("input[name='notification_period']").val(data.notification_period)
          $("input[name='email']").val(data.email)
          $("input[name='phone']").val(data.phone)

          // 消息类型订阅
          var notify_msg_type = data.notify_msg_type
          if (notify_msg_type) {
            var notify_msg_type_arr = notify_msg_type.split(/\s+/)
            for (let index = 0; index < notify_msg_type_arr.length; index++) {
              const element = notify_msg_type_arr[index];
              $("input[name='notify_msg_type'][value='"+element+"']").prop("checked",true)
            }
          }

          // 通知方式
          var notify_method = data.notify_method
          if (notify_method) {
            var notify_method_arr = notify_method.split(/\s+/)
            for (let index = 0; index < notify_method_arr.length; index++) {
              const element = notify_method_arr[index];
              $("input[name='notify_method'][value='"+element+"']").prop("checked",true)
            }
          }

          // 模板
          $("input[name='ip_disable_templ']").val(data.ip_disable_templ)
          $("input[name='ip_disable_templ_id']").val(data.ip_disable_templ_id)
          $("input[name='ip_enable_templ']").val(data.ip_enable_templ)
          $("input[name='ip_enable_templ_id']").val(data.ip_enable_templ_id)
          $("input[name='bandwidth_exceed_templ']").val(data.bandwidth_exceed_templ)
          $("input[name='bandwidth_exceed_templ_id']").val(data.bandwidth_exceed_templ_id)
          $("input[name='bandwidth_restore_templ']").val(data.bandwidth_restore_templ)
          $("input[name='bandwidth_restore_templ_id']").val(data.bandwidth_restore_templ_id)
          $("input[name='backup_ip_disable_templ']").val(data.backup_ip_disable_templ)
          $("input[name='backup_ip_disable_templ_id']").val(data.backup_ip_disable_templ_id)
          $("input[name='backup_ip_enable_templ']").val(data.backup_ip_enable_templ)
          $("input[name='backup_ip_enable_templ_id']").val(data.backup_ip_enable_templ_id)
          $("input[name='backup_default_line_disable_templ']").val(data.backup_default_line_disable_templ)
          $("input[name='backup_default_line_disable_templ_id']").val(data.backup_default_line_disable_templ_id)
          $("input[name='backup_default_line_enable_templ']").val(data.backup_default_line_enable_templ)
          $("input[name='backup_default_line_enable_templ_id']").val(data.backup_default_line_enable_templ_id)
          $("input[name='backup_node_group_disable_templ']").val(data.backup_node_group_disable_templ)
          $("input[name='backup_node_group_disable_templ_id']").val(data.backup_node_group_disable_templ_id)
          $("input[name='backup_node_group_enable_templ']").val(data.backup_node_group_enable_templ)
          $("input[name='backup_node_group_enable_templ_id']").val(data.backup_node_group_enable_templ_id)

          $("input[name='monitor_api']").val(data.monitor_api)

          // 短信类型
          if (window.sms_type == "smsbao") {
            $(".smsbao").removeClass("layui-hide")
            $(".qcloud").addClass("layui-hide")
          } else {
            $(".smsbao").addClass("layui-hide")
            $(".qcloud").removeClass("layui-hide")
            $(".ip-disable-templ-qcloud").find("input").val(phone_templ_convert(data.ip_disable_templ))
            $(".ip-enable-templ-qcloud").find("input").val(phone_templ_convert(data.ip_enable_templ))

            $(".bandwidth-exceed-templ-qcloud").find("input").val(phone_templ_convert(data.bandwidth_exceed_templ))
            $(".bandwidth-restore-templ-qcloud").find("input").val(phone_templ_convert(data.bandwidth_restore_templ))

            $(".backup-ip-disable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_ip_disable_templ))
            $(".backup-ip-enable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_ip_enable_templ))

            $(".backup-default-line-disable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_default_line_disable_templ))
            $(".backup-default-line-enable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_default_line_enable_templ))

            $(".backup-node-group-disable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_node_group_disable_templ))
            $(".backup-node-group-enable-templ-qcloud").find("input").val(phone_templ_convert(data.backup_node_group_enable_templ))

          }

          form.render()
        }
      });
    })



    // 保存
    function save() {
      var interval = $("input[name='interval']:checked").val()
      var failed_times = $("input[name='failed_times']").val()
      var failed_rate = $("input[name='failed_rate']").val()
      var bw_exceed_times = $("input[name='bw_exceed_times']").val()
      var monitor_api = $("input[name='monitor_api']").val()

      var notification_period = $("input[name='notification_period']").val()
      var email = $("input[name='email']").val()
      var phone = $("input[name='phone']").val()

      // 通知方式
      var notify_method_arr = []
      if ($("input[name='notify_method'][value='email']").prop("checked") == true) {
        notify_method_arr.push("email")
      }

      if ($("input[name='notify_method'][value='sms']").prop("checked") == true) {
        notify_method_arr.push("sms")
      }

      var notify_method = notify_method_arr.join(" ")

      // 类型订阅
      var notify_msg_type_arr = []
      if ($("input[name='notify_msg_type'][value='节点IP解析']").prop("checked") == true) {
        notify_msg_type_arr.push("节点IP解析")
      }

      if ($("input[name='notify_msg_type'][value='带宽监控']").prop("checked") == true) {
        notify_msg_type_arr.push("带宽监控")
      }

      if ($("input[name='notify_msg_type'][value='备用IP']").prop("checked") == true) {
        notify_msg_type_arr.push("备用IP")
      }

      if ($("input[name='notify_msg_type'][value='备用默认解析']").prop("checked") == true) {
        notify_msg_type_arr.push("备用默认解析")
      }

      if ($("input[name='notify_msg_type'][value='备用线路组']").prop("checked") == true) {
        notify_msg_type_arr.push("备用线路组")
      }

      var notify_msg_type = notify_msg_type_arr.join(" ")

      // 模板及模板id
      var ip_disable_templ = $("input[name='ip_disable_templ']").val()
      var ip_disable_templ_id = $("input[name='ip_disable_templ_id']").val()
      var ip_enable_templ = $("input[name='ip_enable_templ']").val()
      var ip_enable_templ_id = $("input[name='ip_enable_templ_id']").val()
      var bandwidth_exceed_templ = $("input[name='bandwidth_exceed_templ']").val()
      var bandwidth_exceed_templ_id = $("input[name='bandwidth_exceed_templ_id']").val()
      var bandwidth_restore_templ = $("input[name='bandwidth_restore_templ']").val()
      var bandwidth_restore_templ_id = $("input[name='bandwidth_restore_templ_id']").val()
      var backup_ip_disable_templ = $("input[name='backup_ip_disable_templ']").val()
      var backup_ip_disable_templ_id = $("input[name='backup_ip_disable_templ_id']").val()
      var backup_ip_enable_templ = $("input[name='backup_ip_enable_templ']").val()
      var backup_ip_enable_templ_id = $("input[name='backup_ip_enable_templ_id']").val()
      var backup_default_line_disable_templ = $("input[name='backup_default_line_disable_templ']").val()
      var backup_default_line_disable_templ_id = $("input[name='backup_default_line_disable_templ_id']").val()
      var backup_default_line_enable_templ = $("input[name='backup_default_line_enable_templ']").val()
      var backup_default_line_enable_templ_id = $("input[name='backup_default_line_enable_templ_id']").val()
      var backup_node_group_disable_templ = $("input[name='backup_node_group_disable_templ']").val()
      var backup_node_group_disable_templ_id = $("input[name='backup_node_group_disable_templ_id']").val()
      var backup_node_group_enable_templ = $("input[name='backup_node_group_enable_templ']").val()
      var backup_node_group_enable_templ_id = $("input[name='backup_node_group_enable_templ_id']").val()
      

      var data = JSON.stringify({"notify_msg_type":notify_msg_type, "notify_method":notify_method, "notification_period":notification_period, "email":email, "phone":phone, "monitor_api":monitor_api, "interval":interval,
      "failed_times":failed_times,"failed_rate":failed_rate,"bw_exceed_times":bw_exceed_times,"ip_disable_templ":ip_disable_templ,"ip_disable_templ_id":ip_disable_templ_id,"ip_enable_templ":ip_enable_templ,"ip_enable_templ_id":ip_enable_templ_id,
      "bandwidth_exceed_templ":bandwidth_exceed_templ,"bandwidth_exceed_templ_id":bandwidth_exceed_templ_id,"bandwidth_restore_templ":bandwidth_restore_templ,"bandwidth_restore_templ_id":bandwidth_restore_templ_id,"backup_ip_disable_templ":backup_ip_disable_templ,"backup_ip_disable_templ_id":backup_ip_disable_templ_id,
      "backup_ip_enable_templ":backup_ip_enable_templ,"backup_ip_enable_templ_id":backup_ip_enable_templ_id,"backup_default_line_disable_templ":backup_default_line_disable_templ,"backup_default_line_disable_templ_id":backup_default_line_disable_templ_id,"backup_default_line_enable_templ":backup_default_line_enable_templ,"backup_default_line_enable_templ_id":backup_default_line_enable_templ_id,
      "backup_node_group_disable_templ":backup_node_group_disable_templ,"backup_node_group_disable_templ_id":backup_node_group_disable_templ_id,"backup_node_group_enable_templ":backup_node_group_enable_templ,"backup_node_group_enable_templ_id":backup_node_group_enable_templ_id})

      admin.req({
        url: '/configs/global-0-system-node_monitor_config' //实际使用请改成服务端真实接口
        ,type: "put"
        ,data: JSON.stringify({"value": data})
        ,contentType:"application/json"
        ,dataType: "json"
        ,done: function(res){ 
          //登入成功的提示与跳转
          layer.msg('保存成功', {
            offset: '15px'
            ,icon: 1
            ,time: 1000
          });
        }
      });
    }


    form.on('radio(interval)', function(data){
      save()
    });  
  
    // 监听input
    $("input[name='ip_disable_templ'],input[name='ip_disable_templ_id'],input[name='ip_enable_templ'],input[name='ip_enable_templ_id'],input[name='bandwidth_exceed_templ'],input[name='bandwidth_exceed_templ_id'],input[name='bandwidth_restore_templ'],input[name='bandwidth_restore_templ_id'],input[name='backup_ip_disable_templ'],input[name='backup_ip_disable_templ_id'],input[name='backup_ip_enable_templ'],input[name='backup_ip_enable_templ_id'],input[name='backup_default_line_disable_templ'],input[name='backup_default_line_disable_templ_id'],input[name='backup_default_line_enable_templ'],input[name='backup_default_line_enable_templ_id'],input[name='backup_node_group_disable_templ'],input[name='backup_node_group_disable_templ_id'],input[name='backup_node_group_enable_templ'],input[name='backup_node_group_enable_templ_id'],input[name='failed_times'],input[name='bw_exceed_times'], input[name='failed_rate'],input[name='monitor_api'],input[name='notification_period'],input[name='email'],input[name='phone']").change(function (params) {
      save()
    })

    form.on('checkbox(notify_method)', function(data){
      save()
    });       

    form.on('checkbox(notify_msg_type)', function(data){
      save()
    });

  });  

</script>